package RMIClient;

import java.rmi.Naming;
import java.rmi.RMISecurityManager;

import raceReservationServer.IReservationRaceServer;

public class RMIServiceLocator {
	private IReservationRaceServer service;

	public IReservationRaceServer getService(String serviceURL) 
	{
		if (System.getSecurityManager() == null)
		{
			System.setSecurityManager(new RMISecurityManager());
		}
		try
		{
			System.out.println(serviceURL);
			service = (IReservationRaceServer)Naming.lookup(serviceURL);
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
		return service;
	}
}
